/*
 * Copyright (C) 2017 Egorov E.V.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * FInitRoll.java
 *
 * <p>Created on 20.01.2017, 22:25:36
 */
package ru.apertum.qsystem.client.forms;

/**
 * Задать параметры для услуги-рулона.
 *
 * @author Egorov EV
 */
@SuppressWarnings({"squid:S1192", "squid:S1172", "squid:S1450", "squid:S1604", "squid:S1161", "squid:MaximumInheritanceDepth"})
public class FInitRoll extends javax.swing.JDialog {

    public FInitRoll(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
    }

    public int getFirstNumber() {
        return (int) spFirst.getValue();
    }

    public int getLastNumber() {
        return (int) spLast.getValue();
    }

    public int getCurrentNumber() {
        return (int) spCurrent.getValue();
    }

    private boolean ok = false;

    public boolean isOk() {
        return ok;
    }

    /**
     * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        qPanel1 = new ru.apertum.qsystem.client.model.QPanel();
        labelFirst = new javax.swing.JLabel();
        spFirst = new javax.swing.JSpinner();
        spLast = new javax.swing.JSpinner();
        spCurrent = new javax.swing.JSpinner();
        labelLast = new javax.swing.JLabel();
        labelCurrent = new javax.swing.JLabel();
        btnInit = new javax.swing.JButton();

        qPanel1.setName("qPanel1"); // NOI18N

        javax.swing.GroupLayout qPanel1Layout = new javax.swing.GroupLayout(qPanel1);
        qPanel1.setLayout(qPanel1Layout);
        qPanel1Layout.setHorizontalGroup(
                qPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGap(0, 100, Short.MAX_VALUE)
        );
        qPanel1Layout.setVerticalGroup(
                qPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGap(0, 100, Short.MAX_VALUE)
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance().getContext().getResourceMap(FInitRoll.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setName("Form"); // NOI18N
        setResizable(false);

        labelFirst.setText(resourceMap.getString("labelFirst.text")); // NOI18N
        labelFirst.setName("labelFirst"); // NOI18N

        spFirst.setModel(new javax.swing.SpinnerNumberModel(1, 1, 10000, 10));
        spFirst.setName("spFirst"); // NOI18N
        spFirst.setPreferredSize(new java.awt.Dimension(60, 20));

        spLast.setModel(new javax.swing.SpinnerNumberModel(1000, 100, 10000, 10));
        spLast.setName("spLast"); // NOI18N
        spLast.setPreferredSize(new java.awt.Dimension(60, 20));

        spCurrent.setModel(new javax.swing.SpinnerNumberModel(1, 1, 10000, 1));
        spCurrent.setName("spCurrent"); // NOI18N
        spCurrent.setPreferredSize(new java.awt.Dimension(60, 20));

        labelLast.setText(resourceMap.getString("labelLast.text")); // NOI18N
        labelLast.setName("labelLast"); // NOI18N

        labelCurrent.setText(resourceMap.getString("labelCurrent.text")); // NOI18N
        labelCurrent.setName("labelCurrent"); // NOI18N

        btnInit.setText(resourceMap.getString("btnInit.text")); // NOI18N
        btnInit.setName("btnInit"); // NOI18N
        btnInit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnInitActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                                .addContainerGap()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(layout.createSequentialGroup()
                                                .addComponent(labelCurrent)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                .addComponent(spCurrent, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGroup(layout.createSequentialGroup()
                                                .addComponent(labelFirst)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                .addComponent(spFirst, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGroup(layout.createSequentialGroup()
                                                .addComponent(labelLast)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                .addComponent(spLast, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addContainerGap(80, Short.MAX_VALUE))
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addContainerGap(140, Short.MAX_VALUE)
                                .addComponent(btnInit)
                                .addContainerGap())
        );
        layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(labelFirst)
                                        .addComponent(spFirst, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(labelLast)
                                        .addComponent(spLast, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(labelCurrent)
                                        .addComponent(spCurrent, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 23, Short.MAX_VALUE)
                                .addComponent(btnInit)
                                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnInitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnInitActionPerformed
        ok = true;
        setVisible(false);
    }//GEN-LAST:event_btnInitActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnInit;
    private javax.swing.JLabel labelCurrent;
    private javax.swing.JLabel labelFirst;
    private javax.swing.JLabel labelLast;
    private ru.apertum.qsystem.client.model.QPanel qPanel1;
    private javax.swing.JSpinner spCurrent;
    private javax.swing.JSpinner spFirst;
    private javax.swing.JSpinner spLast;
    // End of variables declaration//GEN-END:variables
}
